# 数据库相关
DB_DEVICE_HEARTBEAT_DOCUMENT = "device_heartbeat"
DB_DEVICE_ALARM_DOCUMENT = "device_alarm"
DB_DEVICE_EXCEPTION_STATUS_INTERVAL_DOCUMENT = "device_exception_status_interval"  # 设备异常状态持续时间片
DB_RAPID_RESPONSE_DOCUMENT = "rapid_response"  # 快反记录（设备中断）

# RABBITMQ相关
MQ_DEVICE_STATUS_COMPUTE_PUSHING = "device_status_compute_pushing"  # 订阅设备状态相关的MQ

RAPID_RESPONSE_REASON_COUNT_DB = "rapid_response_reason_count"  # 本项目新建维护，人为上报的中断原因记录频次

STATUS_MAP = {
    0: "关机",
    1: "正常",
    2: "待机",  # "其他中断",  # 正常待机（也算做其他中断）【待机】，不会推送生产单元监控和微信
    3: "故障",  # "故障中断",  # 故障【故障】
    4: "断流",  # "缺料中断",  # 缺料（指的是流水线上下游间缺料）【断流】
    5: "缺料",  # "缺料中断",  # 缺料（指的是机器辅料缺料）【缺料】
    6: "满料",  # "其他中断",  # 满料【满料】
    7: "状态未知",  # "离线"  # 现在已经没有这种状态的时间片了！有就是出错了。
    8: "急停",  # 当作关机处理
    9: "调试",  # 当作关机处理
}

BREAK_TYPE_MAP = {
    "故障中断": "fault_break",
    "缺料中断": "lack_material",
    "其他中断": "others",
    "质量中断": "quality",
}

# 设备状态转换映射
DEVICE_STATUS_TRANCE_MAP = {
    "St0": 1,
    "St1": 3,
    "St2": 5,
    "St3": 2
}
RAPID_RESPONSE_REASON_CONFIG_DB = "rapid_response_reason_config"  # 本项目新建维护，人为上报的中断原因配置
